﻿package plugin.roleN.handler
{
    import cmd.*;
    import com.core.*;
    import flash.utils.*;
    import plugin.fcactivity.*;
    import plugin.roleN.model.*;
    import pluginfw.nio.*;
    import pluginfw.nio.imsg.*;

    public class ReinHandler extends Object implements IGroupHandler
    {
        private var resultexp:Object;

        public function ReinHandler()
        {
            return;
        }// end function

        public function dealSimpleMessage(param1:ISimpleMessage) : void
        {
            var _loc_2:Object = null;
            switch(param1.getCmd())
            {
                case CMDRole.Zhuan:
                {
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function dealBufferMessage(param1:IBufferMessage) : void
        {
            var _loc_2:Input = null;
            var _loc_3:ByteArray = null;
            var _loc_4:Object = null;
            var _loc_5:Object = null;
            var _loc_6:Input = null;
            var _loc_7:ByteArray = null;
            switch(param1.getCmd())
            {
                case CMDRein.InitBack:
                {
                    this.resultexp = new Object();
                    _loc_2 = new Input(null);
                    _loc_3 = param1.getBody();
                    _loc_3.position = 0;
                    _loc_2.setBytes(_loc_3);
                    this.resultexp.reinEnergy = _loc_2.readVarInt(false);
                    ModelProxy.change("zhuan", "getatt", this.resultexp);
                    ModelProxy.change("mainview", "updataRein", this.resultexp);
                    break;
                }
                case CMDRein.ReinEnergy:
                {
                    _loc_5 = new Object();
                    _loc_6 = new Input(null);
                    _loc_7 = param1.getBody();
                    _loc_7.position = 0;
                    _loc_6.setBytes(_loc_7);
                    _loc_5.reinEnergy = _loc_6.readVarInt(false);
                    ModelProxy.change("zhuan", "reinEnergy", _loc_5);
                    ModelProxy.change("zhuan", "getatt", _loc_5);
                    ModelProxy.change("mainview", "updataRein", _loc_5);
                    break;
                }
                case CMDRein.Zhuan:
                {
                    _loc_4 = new Object();
                    _loc_2 = new Input(null);
                    _loc_3 = param1.getBody();
                    _loc_3.position = 0;
                    _loc_2.setBytes(_loc_3);
                    _loc_4.rein = _loc_2.readVarInt(false);
                    ModelProxy.change("movetips", "error", "成功转生至" + _loc_4.rein + "转");
                    ModelProxy.change("data", "user.rein", _loc_4.rein);
                    ModelProxy.change("role", "updaterein", _loc_4.rein);
                    ModelProxy.change("mianui", "updaterein", _loc_4.rein);
                    ModelProxy.change("guanwei", "updaterein", _loc_4.rein);
                    ModelProxy.change("fcactivity", "refresh", null);
                    ModelProxy.change("qianghua", "updatelevel", null);
                    FCActivityUtil.checkCanGet();
                    ModelProxy.change("zhuan", "updatezhuan", null);
                    ModelProxy.change("zhuan", "zhuansucc", this.resultexp);
                    ModelProxy.change("fashen", "updateRein", null);
                    ModelProxy.change("mainview", "updataRein", this.resultexp);
                    ModelProxy.change("mainui", "updateHero", null);
                    ModelProxy.change("bossChallenge", "updateFBJZ", null);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function dealProxyMessage(param1:IProxyMessage) : void
        {
            return;
        }// end function

    }
}
